<?php defined('KX_ROOT') || exit('Permission denied');?><!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8" name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    <title><?php include \Kuxin\View::parseTpl($tkd['title']);?></title>
    <meta name="keywords" content="<?php include \Kuxin\View::parseTpl($tkd['keywords']);?>">
    <meta name="description" content="<?php include \Kuxin\View::parseTpl($tkd['description']);?>">
	<link rel="stylesheet" href="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/css/global.css"/>
	<script src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/js/flexible.min.js"></script>
    <link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
    <meta name="author" content="www.ptcms.com">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width" />
    <meta name="applicable-device" content="pc">
    <meta http-equiv="mobile-agent" content="format=html5; url=<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "mobileurl");?><?php echo $_SERVER['REQUEST_URI'];?>">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta http-equiv="Cache-Control" content="no-transform" />
    <link rel="canonical" href="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "pcurl");?><?php echo $_SERVER['REQUEST_URI'];?>" />
	<style>
        .pt-search{
            width:100%;
            padding:0.20rem ;
            border-radius:0.02rem;
        }
        .pt-search-box{
            width:80vw;
            height:0.30rem;
            background-color: #f2f2f7;
            padding-left: 0.13rem;
        }
        .pt-recall{
            font-size: 0.1rem;
        }
        .history {
            background-color: #fff;
            margin: 10px;
            padding: 10px;
        }
        .history h1{
            font-size: 16px;
            color: #666;
            margin-bottom: 10px;
        }
        .history h1 span{
            font-size: 12px;
            float: right;
        }
        .history ul li{
            display: inline-block;
            background-color: #f0f0f0;
            padding: 3px 10px;
            border-radius: 4px;
            margin: 5px;
        }
        .pt-pages{
            bottom: 0;
            height: 50px;
            text-align: center;
            border-top: 1px solid #E9E9E9;
        }
        .pt-pages-select{
            border-color: #F55!important;
            background-color: #F55!important;
            color: #fff!important;
        }
        .pt-pages span {
            width: 24px;
            height: 24px;
            border: 1px solid #fff;
            text-align: center;
            line-height: 24px;
            margin-right: 10px;
        }
        .flex-item{max-width: 2.65rem}
	</style>
</head>
<body>
    <form action="<?php echo \Kuxin\Helper\Url::build("novel.search.result",[],"");?>" class="searchForm">
        <div class="w100 bg-white flex-wrp flex-between flex-align-center pt-search">
            <div class="flex-wrp flex-align-center pt-search-box" style="width: 80vw;">
                <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/search.png" class="mr10 pt-search-icon" >
                <input type="text" name="searchkey" class="size12 color4" style="width: 100%" placeholder="请输入您要搜索的关键书名" value="<?php echo $searchkey;?>">
            </div>
            <div class="pt-recall">取消</div>
        </div>
    </form>
	<!-- 站长推荐 -->
	<div class="w100 bg-white lh100 pt-recomment">
        <?php $result=\Kuxin\Block::show('search', ['searchkey'=>$searchkey,'page'=>$page,'num'=>$pagesize]);?>
        <?php $paginate=\Kuxin\Block::show('pagination', ['page'=>$page,'limit'=>$pagesize,'count'=>$result['count'],'maxpage'=>50,'section'=>3]);?>
        <?php if($result['count'] > 0):?>
        <?php if(is_array($result['items']) && (array()!=$result['items'])): $i=array(); $i['loop']=array_slice($result['items'],0,null,true); $i['total']=count($result['items']); $i['count']=count($i['loop']); $i['cols']=1; $i['add']=$i['count']%1?1-$i['count']%1:0; $i['order']=0; $i['row']=1;$i['col']=0;foreach(array_pad($i['loop'],$i['add'],array()) as $i['index']=>$i['list']): $loop=$i['list']; $i['order']++; $i['col']++; if($i['col']==1): $i['col']=0; $i['row']++; endif; $i['first']=$i['order']==1; $i['last']=$i['order']==$i['count']; $i['extra']=$i['order']>$i['count'];?>
        <div class="pt-recomment-cont">
            <div class="flex-wrp pt-recomment-item">
                <a href="<?php echo \Kuxin\Helper\Url::build("novel.novel.index",['novelid'=>$loop['novel']['id'],'pinyin'=>$loop['novel']['pinyin']],"");?>">
                    <img src="<?php echo $loop['novel']['cover'];?>" class="mr15" alt="<?php echo $loop['novel']['name'];?>">
                </a>
                <div class="flex-item pt5">
                    <div class="flex-wrp flex-between">
                        <div class="size14 color7">
                            <a title="<?php echo $loop['novel']['name'];?>" href="<?php echo \Kuxin\Helper\Url::build("novel.novel.index",['novelid'=>$loop['novel']['id'],'pinyin'=>$loop['novel']['pinyin']],"");?>"><?php echo $loop['novel']['name'];?></a>
                        </div>
                        <div class="color2 size14"><?php echo $loop['data']['mark'];?> <span class="size12">人在追</span></div>
                    </div>
                    <div class="size12 compulsory-row mb10 mt10 lh130 color4"><?php echo showIntroLine($loop['novel']['intro']);?></div>
                    <div class="flex-wrp flex-between">
                        <div class="color5 size12">
                            <a title="<?php echo $loop['author']['name'];?>" href="<?php echo \Kuxin\Helper\Url::build("author.space.index",['authorid'=>$loop['author']['id'],'pinyin'=>$loop['author']['pinyin'],'name'=>$loop['author']['name']],"");?>">[ <?php echo $loop['author']['name'];?> ]</a>
                        </div>
                        <div class="pt-recomment-label">
                            <a title="<?php echo $loop['category']['name'];?>" href="<?php echo \Kuxin\Helper\Url::build("novel.category.list",['id'=>$loop['category']['id'],'key'=>$loop['category']['key']],"");?>"><?php echo $loop['category']['name'];?></a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php endforeach; endif;?>
        <?php if($paginate['total']>1):?>
        <div class="pt-pages">
            <div class="pt30 color5">
                <?php if($paginate['prev']):?>
                <a href="<?php echo \Kuxin\Helper\Url::build("novel.search.result",['searchkey'=>$_GET['searchkey'],'page'=>$paginate['prev']],"");?>"><span><</span></a>
                <?php else:?>
                <span class="disable"><</span>
                <?php endif;?>
                <?php if(is_array($paginate['items'])): foreach($paginate['items'] as $key =>$loop):?>
                <a href="<?php echo \Kuxin\Helper\Url::build("novel.search.result",['searchkey'=>$_GET['searchkey'],'page'=>$loop['num']],"");?>">
                    <span class="<?php echo \Kuxin\View::default($loop['status'],'','pt-pages-select');?>"><?php echo $loop['num'];?></span>
                </a>
                <?php endforeach; endif;?>
                <?php if($paginate['next']):?>
                <a href="<?php echo \Kuxin\Helper\Url::build("novel.search.result",['searchkey'=>$_GET['searchkey'],'page'=>$paginate['next']],"");?>"><span>></span></a>
                <?php else:?>
                <span class="disable">></span>
                <?php endif;?>
            </div>
        </div>
        <?php endif;?>
        <?php else:?>
        <div class="pt-recomment-cont"  style="text-align: center;padding: 25px 0;">
            <img src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/images/no-data-img.png" style="width: 120px;height: 120px;">
            <h1 class="size18 color5 mt10 mb15">没有输入有效关键词</h1>
            <span class="size16 ">你也可以去 <a href="/" class="color2">全部作品</a> 找书</span>
        </div>
        <div class="history">
            <h1>历史搜索 <span>清空</span></h1>
            <ul></ul>
        </div>
        <?php endif;?>
	</div>

    <!-- 底部版权 -->
    <div class="pt-copyright">
    <div class="size12  w100 text-center mt15 mb10"><a title="隐私声明" href="<?php echo \Kuxin\Helper\Url::build("page.detail",['key'=>'privacy'],"");?>" class="color4">隐私声明</a> | <a title="免责声明" href="<?php echo \Kuxin\Helper\Url::build("page.detail",['key'=>'disdaimer'],"");?>" class="color4">免责声明</a> | <a title="关于我们" href="<?php echo \Kuxin\Helper\Url::build("page.detail",['key'=>'about'],"");?>" class="color4">关于我们</a></div>
    <div class="size12 color4 w100 text-center mb10">Copyright © 2009-<?php echo date(Y);?> <?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "beian");?></div>
    <div class="size12  w100 text-center"><?php echo \Kuxin\Response::runinfo();?></div>
</div>
<!-- js -->
<script src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/js/jquery-3.3.1.js"></script>
<script>
    $('.pt-return,.pt-recall').click(function(){
        window.history.back();
    });
    $('.pt-ellipsis').click(function(){
        $('.pt-tip').toggle()
    });
    $('.pt-tip .pt-tip-item').click(function(){
        $('.pt-tip').toggle()
    });
</script>
<div class="none">
    <?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "tongji.mobile");?>
    <?php if(\Kuxin\Helper\Arr::getValue($_kxcms_config, "app.use_cdn")):?>
    <script src="/api/stat/novel/info.js"></script>
    <script src="/api/stat/novel/read.js"></script>
    <?php endif;?>
</div>
	<!-- js -->
    <script src="<?php echo \Kuxin\Helper\Arr::getValue($_kxcms_config, "resurl");?>/template/kxmobileno1/js/jquery-3.3.1.js"></script>
	<script>
        var historyStr = window.localStorage.getItem('search_history');
        historyList = typeof historyStr === 'string' ? historyStr.split('|||') : [];
        $.each(historyList, function (k, v) {
            if(v){
                $('.history ul').append('<li><a href="<?php echo \Kuxin\Helper\Url::build("novel.search.result",[],"");?>?searchkey=' + encodeURI(v) + '">' + v + '</a></li>');
            }
        });
        $('.searchForm').submit(function () {
            historyList.push($('.searchForm input[name=searchkey]').val());
            var uniqueArr = [];
            $.each(historyList, function(i, el){
                if($.inArray(el, uniqueArr) === -1) uniqueArr.push(el);
            });
            window.localStorage.setItem('search_history', uniqueArr.join('|||'));
        });
        $('.history h1 span').click(function () {
            $('.history ul li').remove();
            window.localStorage.removeItem('search_history');
        });
	</script>
</body>
</html>